﻿/* **************************************************************************
 *
 * Copyright 2007-2010 Jeff Hardy
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * *************************************************************************/

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Server;
using System.Collections;

namespace NWSGI.ManagementClient
{
    internal class NwsgiModuleServiceProxy : ModuleServiceProxy
    {
        public PropertyBag GetConfiguration()
        {
            return (PropertyBag)Invoke("GetConfiguration");
        }

        public void UpdateConfiguration(PropertyBag bag)
        {
            Invoke("UpdateConfiguration", bag);
        }

        #region PythonPaths

        public ArrayList GetPythonPaths()
        {
            return (ArrayList)Invoke("GetPythonPaths");
        }

        public void AddPythonPath(string path)
        {
            Invoke("AddPythonPath", path);
        }

        public void EditPythonPath(string oldPath, string newPath)
        {
            Invoke("EditPythonPath", oldPath, newPath);
        }

        public void DeletePythonPath(string path)
        {
            Invoke("DeletePythonPath", path);
        }

        #endregion

        #region WsgiEnviron

        public ArrayList GetWsgiEnviron()
        {
            return (ArrayList)Invoke("GetWsgiEnviron");
        }

        public void AddWsgiEnvironVariable(WsgiEnvironInfo value)
        {
            Invoke("AddWsgiEnvironVariable", (object)value.ToArray());
        }

        public void EditWsgiEnvironVariable(WsgiEnvironInfo value)
        {
            Invoke("EditWsgiEnvironVariable", (object)value.ToArray());
        }

        public void DeleteWsgiEnvironVariable(WsgiEnvironInfo selected)
        {
            Invoke("DeleteWsgiEnvironVariable", selected.Name);
        }

        #endregion

        #region ScriptMappings

        public ArrayList GetScriptMappings()
        {
            return (ArrayList)Invoke("GetScriptMappings");
        }

        public void AddScriptMapping(ScriptMappingInfo value)
        {
            Invoke("AddScriptMapping", (object)value.ToArray());
        }

        public void EditScriptMapping(ScriptMappingInfo values)
        {
            Invoke("EditScriptMapping", (object)values.ToArray());
        }

        public void DeleteScriptMapping(ScriptMappingInfo selected)
        {
            Invoke("DeleteScriptMapping", selected.ScriptName);
        }

        #endregion
    }
}
